package com.turing.post.cardmanagement.util;

import java.io.Serializable;
import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * 应用卡面关联表
 * 
 * @author kangzhe
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "APPCARDFACEASSOC")
@IdClass(AppCardFaceAssoc.class)
public class AppCardFaceAssoc implements Serializable {

	/**
	 * 应用ID
	 */
	private BigInteger appId;

	@Id
	@Column(name = "APPID")
	public BigInteger getAppId() {
		return appId;
	}

	public void setAppId(BigInteger appId) {
		this.appId = appId;
	}

	/**
	 * 卡面ID
	 */
	private BigInteger cardFaceId;

	@Id
	@Column(name = "CARDFACEID")
	public BigInteger getCardFaceId() {
		return cardFaceId;
	}

	public void setCardFaceId(BigInteger cardFaceId) {
		this.cardFaceId = cardFaceId;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getAppId() == null) ? 0 : getAppId().hashCode());
		result = prime * result
				+ ((getCardFaceId() == null) ? 0 : getCardFaceId().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final AppCardFaceAssoc other = (AppCardFaceAssoc) obj;
		if (getAppId() == null) {
			if (other.getAppId() != null)
				return false;
		} else if (!getAppId().equals(other.getAppId()))
			return false;
		if (getCardFaceId() == null) {
			if (other.getCardFaceId() != null)
				return false;
		} else if (!getCardFaceId().equals(other.getCardFaceId()))
			return false;
		return true;
	}
}
